<%-------------------------------------------------------------------
 * 页面名称：selectPayMode.jsp
 * 功能描述：网上银行充值－银行接口跳转页面
 * Action  : 
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="struts-html.tld" prefix="html"%>
<%@ taglib uri="struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="struts-logic.tld" prefix="logic"%>
<%@ taglib uri="struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%
	String path = request.getContextPath();

	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", -10);
%>
<style type="text/css">
<!--
.box {width:100%;margin:auto;}
.off {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#003365;font-size:12px;font-weight:bold;text-align:center;background-image:url(<%=path%>/images/p_on.gif);cursor:pointer;}
.on {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#B77443;font-size:12px;font-weight:bold;text-align:center;background-image:url(<%=path%>/images/p_hover.gif);}
.tab {width:100%;margin:auto;float:left;background:url(<%=path%>/images/apply_bg02.gif) top left no-repeat}
-->
</style>
<script type="text/javascript" src="<%=path%>/js/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/pagetitle.js"></script>
<script type="text/javascript" src="<%=path%>/js/PassGuardCtrl.js"></script>
<script type='text/javascript' src='<%=path%>/js/demo.js'></script>

<script type="text/javascript">
<!--
function refreshVericode(imgObjName) {
	var now = new Date();
	getObj(imgObjName).src = '<%=path%>/page/util/verifyImage.jsp?now='+now.getTime().toString();
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
var bankInfoPicUrl = "<%=path%>/images/bank/";
function showBankInfo(radioObj,bankcode,b2bSupported) {
    if(radioObj.checked){
        document.getElementById("bankInfoPic").src = bankInfoPicUrl+bankcode+".gif";
        document.getElementById("bankInfo").style.display = "";
    }
}
function getRadioValue(radioObject){
    if(radioObject.length==undefined){
        if(radioObject.checked) return radioObject.value;
    }else{
        for(var i=0;i<radioObject.length;i++){
            if(radioObject[i].checked) return radioObject[i].value;
        }
    }
    return undefined;
}
function prepareParameters(value){
    var bankCode = getRadioValue(document.getElementsByName(value));
    if(bankCode == undefined){
        return false;
    }
    document.forms[0].bankCode.value = bankCode;
    return true;
}

//网银支付
function toBankNetPay(button){
    if(!prepareParameters('netbank')){
        alert("请选择网上银行！");
    }else{
        var formObj = document.forms[0];
        formObj.actionType.value = "<%=Constant.ACTION_TYPE_B2C_NET_PAY%>";
        button.disabled = true;
        formObj.action = "<%=path%>/page/linkbank/bankNetPayRequest.do";
        formObj.submit();
    }
}

function toMyspaceHasLogin() {
	var formObj = document.forms[0];
	formObj.action = "<%=path%>/page/linkbank/toMyspaceHasLogin.do";
	formObj.submit();
}
function toMyspace() {
	if(emptyValidate(getObj("logon_person_email"),"Email或手机") != "") {
			getObj("logon_person_email").focus();
			return false;
	}		
	
	//获取随机因子
	SubmitForm();

	var PwdResult=pgeditor.pwdResult();
	getObj("logon_person_passPerson").value=PwdResult;
	if(pgeditor.pwdLength()==0){
	     alert("请填写登录密码");
		 _$("_ocx_password").focus();
		 return false;
	}
	if(emptyValidate(getObj("logon_person_sys_vericode"),"校验码") != "") {
			getObj("logon_person_sys_vericode").focus();
			return false;
	}				
	document.forms[0].action = "<%=path%>/page/linkbank/toMyspace.do";
	document.forms[0].submit();
}
	function pers() {
		if(event.keyCode==13){
			toMyspace();
		}
	}
//电话银行支付
function toBankTelPay(button) {
    if(!prepareParameters('telbank')){
        alert("请选择电话银行！");
    }else {
    	if(document.getElementById('orderTelephone').value == "") {
    		alert("请输入预留电话！");
			document.getElementById('orderTelephone').focus();
    		return false;
    	}
        button.disabled = true;
        document.forms[0].actionType.value = "<%=Constant.ACTION_TYPE_B2C_TEL_PAY%>";
        document.forms[0].action = "<%=path%>/page/linkbank/bankTelPayRequest.do";
        document.forms[0].submit();
    }
}

	function selectBank(bankCode) {
		// 点击银行图片选择银行方法
		document.getElementById("check_" + bankCode).checked = true;
		showBankInfo(document.getElementById("check_" + bankCode),bankCode);
	}

	function selectTelBank(bankCode) {
		// 点击电话银行图片选择银行方法
		document.getElementById("telcheck_" + bankCode).checked = true;
		showBankInfo(document.getElementById("telcheck_" + bankCode),bankCode);
	}
	
	window.onload = function(){	 
		   pgeditor.pgInitialize();//初始化控件
		}
//-->
</script>

<html:form action="selectPayMode" method="post">
	<input type="hidden" name="actionType" value="" />
	<html:hidden property="bankCode" />
	<html:hidden property="license" />
	<div id="main">
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="logined_info2">
					<span class="bluefont18bdrop"><a href="<%=path%>/main.do"><!--  <img
								src="<%=path%>/images/LOGO-4_a.jpg" border="0" align="absmiddle" />-->
					</a> </span>
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="83%" align="center">
								<table width="100%" class="hometablestyle">
									<tr>
										<th colspan="2">
											<span class="blue14">订单信息</span>
										</th>
									</tr>
									<tr>
										<td width="50%">
											<span class="blue1202">商户名称：</span><span class="orang12b">
												<bean:write name="account" property="name" /> </span>
										</td>
										<td width="50%">
											<span class="blue1202"> 订单编号：</span><span class="orang12b">
												<logic:present parameter="orderId">
													<bean:parameter name="orderId" id="orderId" />
													<bean:write name="orderId" />
												</logic:present> </span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="blue1202">商品名称：</span><span class="orang12b">
												<logic:present parameter="commodity">
													<bean:parameter name="commodity" id="commodity" />
													<bean:write name="commodity" />
												</logic:present> </span>
										</td>
										<td>
											<span class="blue1202">交易金额：</span><span class="orang12b">
												<bean:parameter name="amount" id="amount" /> <ad:FormatPrase>
													<bean:write name="amount" />
												</ad:FormatPrase> </span>元
										</td>
									</tr>
								</table>
							</td>
							<td width="17%" align="center">
								<span class="orangefont14b"> <logic:equal
										name="showPhoto" value="true">
										<img
											src="<%=path%>/page/common/showPhoto.action?dbProperty=photo&compressSize=400&accountId=<bean:write name="account" property="id" />"
											width="112" height="77" />
									</logic:equal> <logic:notEqual name="showPhoto" value="true">
										<img src="<%=path%>/images//nophoto.jpg" width="112"
											height="77" />
									</logic:notEqual> </span>
							</td>
						</tr>
					</table>

					<table width="100%" border="0" align="center" cellpadding="5"
						cellspacing="1">
						<tr>
							<td width="100%" height="60" colspan="2" class="orangefont14b">
								支持以下支付方式:
							</td>
						</tr>
					</table>
					<div class="tab">
						<div class="on" id="Tab_1" onclick="showTab('1');">
							网上银行支付
						</div>
						<div class="off" id="Tab_2" onclick="showTab('2');">
							账户余额支付
						</div>
					</div>
					<div class="drop_bg"></div>
					<div style="clear:both;"></div>
					<!-- 网银支付 -->
					<div class="box" id="cont_1">
						<table width="100%" border="0" align="center" cellpadding="7"
							cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
							<tr>
								<td bgcolor="#fffdf5">
									<table width="100%" border="0" cellpadding="3" cellspacing="0">
										<tr>
											<td width="3%" height="25" valign="top"
												style="border-bottom:1px solid #ccc;">
												<img src="<%=path%>/images/ren.gif" width="22" height="21"
													border="0" align="absmiddle" />
											</td>
											<td width="97%" align="left" class="red12b"
												style="border-bottom:1px solid #ccc;">
												特别提醒
											</td>
										</tr>
										<tr>
											<td valign="top">
												&nbsp;
											</td>
											<td align="left" class="font_gray">
												<img src="<%=path%>/images/arrow2.gif" width="16"
													height="16" align="absmiddle" />
												如果您使用的浏览器具有
												<span class="text9green">阻止弹出窗口功能</span>，请先将网站添加到浏览器的允许弹出窗口列表中
											</td>
										</tr>

									</table>
							</td>
							</tr>
						</table>
						<table width="100%" border="0" cellspacing="0" cellpadding="8">
							<tr>
								<td width="18%" align="right" class="org">
									请选择网上银行：
								</td>
								<td width="82%"></td>
							</tr>
							<tr>
								<td class="org">
									&nbsp;
								</td>
								<td>
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<c:forEach var="bank" items="${netbanklist}"
											varStatus="status">
											<c:if test="${status.index % 3 == 0}">
												<tr>
											</c:if>
											<td width="5%">
												<input type="radio" style="border:0;" name="netbank"
													value="<c:out value="${bank.bankCode}"/>"
													onclick="javascript:showBankInfo(this,'<c:out value="${bank.linkCode}"/>',<c:out value="${bank.b2bSupported}"/>);"
													id="check_<c:out value="${bank.linkCode}"/>" />
											</td>
											<td width="45%">
												<a
													href="javascript:selectBank('<c:out value="${bank.linkCode}"/>')">
													<img alt="<c:out value="${bank.bankName}"/>" border="0"
														src="<%=path%>/images/bank/logo/logo_<c:out value="${bank.linkCode}"/>.gif"
														width="160" height="40" /> </a>
											</td>
											<c:if test="${status.index % 3 == 2}">
												</tr>
											</c:if>
											<c:if test="${status.last && status.count % 3 == 2}">
												<td>
													&nbsp;
												</td>
												<td>
													&nbsp;
												</td>
												</tr>
											</c:if>
										</c:forEach>
									</table>
								</td>
							</tr>
							<tr>
								<td class="org">
									&nbsp;
								</td>
								<td>
									<input name="next" type="button" class="button_style"
										onclick="toBankNetPay(this);" value="下一步" />
								</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<!-- 银行信息说明图片显示位置 -->
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr id="bankInfo" style="display:none">
											<td align="center" colspan="2" bgcolor="#FFFFFF">
												<img id="bankInfoPic" src="" border="0" />
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</div>
					<!-- 账户支付 -->
					<div class="box" id="cont_2" style="display:none;"
						onKeyDown="pers()">
						<bean:parameter name="assuredPay" id="assuredPay" />
						<!-- 未登录 -->
						<logic:empty name="sessionAccountSummary">
							<table width="100%" border="0" cellspacing="1" cellpadding="3">
								<logic:empty name="assuredPay">
									<tr>
										<td width="11%" rowspan="4" align="center" nowrap="nowrap"
											class="font_blue">
											<img src="<%=path%>/images/login_icon.gif" width="100"
												height="100" />
										</td>
										<td align="right" valign="top" nowrap="nowrap"
											class="font_blue">
											登录类型：
										</td>
										<td>
											<input type="radio" name="assuredPay" value="false" checked
												style="border:0;" />
											<a href="#"
												onClick="document.forms[0].assuredPay[0].click();"> <span
												class="orang12b">非担保支付<br /> </span> </a>
											<span class="font_gray">(本网站不提供第三方支付担保。在您付款后，货款直接支付到卖家账户，更加快速便捷。)
											</span>
											<br />
											<input type="radio" name="assuredPay" value="true"
												style="border:0;">
											<a href="#"
												onClick="document.forms[0].assuredPay[1].click();"> <span
												class="orang12b">担保支付<br /> </span> </a>
											<span class="font_gray">
												本网站为您提供第三方支付担保。在您付款后，货款先进入网站担保账户，您收到商品并对其满意后，才将货款支付给商家，更加安全。</span>
										</td>
									</tr>
								</logic:empty>
								<logic:notEmpty name="assuredPay">
									<tr>
										<td width="11%" rowspan="4" align="center" nowrap="nowrap"
											class="font_blue">
											<img src="<%=path%>/images/login_icon.gif" width="100"
												height="100" />
										</td>
									</tr>
								</logic:notEmpty>
								<tr>
									<td width="14%" align="right" nowrap="nowrap" class="font_blue">
										Email或手机：
									</td>
									<td width="75%">
										<input class="inputStyle" name="logon_person_email"
											id="logon_person_email" type="text" size="30"  class="login_inputsytle" />
									</td>
								</tr>
								<tr>
									<td align="right" class="font_blue">
										登录密码：
									</td>
									<td>
									<script type="text/javascript">pgeditor.generate()</script>
									<input name="logon_person_passPerson" type="hidden" value="登录密码"
							 class="login_inputsytle"
							maxlength="64" />
									</td>
								</tr>
								<tr>
									<td align="right" class="font_blue">
										校验码：
									</td>
									<td>
										<input class="inputStyle" name="logon_person_sys_vericode"
											id="logon_person_sys_vericode" type="text" size="5"
											maxlength="4"  class="login_inputsytle" />
										<img name="logon_sys_vericode_image0"
											src="<%=path%>/page/util/verifyImage.jsp" width="58"
											height="20" border="0" align="absmiddle" />
										<img class="arrowPosi"
											src="<%=path%>/page/information/images/reset.gif" width="13"
											height="12" align="absmiddle" style="cursor:hand;"
											title="看不清校验码请点击此图标刷新！"
											onClick="javascript:refreshVericode('logon_sys_vericode_image0');" />
									</td>
								</tr>
								<tr>
									<td colspan="3">
										<hr size="1" color="#CCCCCC" />
									</td>
								</tr>
								<tr>
									<td colspan="3" align="center">
										<input name="button22" type="button" class="graybutton_style"
											onClick="toMyspace()" value="登 录" />
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<input name="button2" type="button"
											class="graybutton_stylelong"
											onclick="location='<%=path%>/toForgot.do'" value="忘记密码" />
									</td>
								</tr>
							</table>
						</logic:empty>
						<!-- 已登录 -->
						<logic:notEmpty name="sessionAccountSummary">
							<table width="100%" border="0" cellpadding="20" cellspacing="1"
								style="border-bottom:3px #ccc solid;">
								<tr>
									<td valign="top" bgcolor="#FFFFFF">
										<table width="100%" border="0" cellspacing="1" cellpadding="3">
											<tr>
												<td></td>
												<td class="font_blue">
													您的账户：
												</td>
												<td>
													<logic:notEmpty name="sessionAccountSummary"
														property="account.email">
														<bean:write name="sessionAccountSummary"
															property="account.email" />
													</logic:notEmpty>
													<logic:empty name="sessionAccountSummary"
														property="account.email">
														<bean:write name="sessionAccountSummary"
															property="account.mobile" />
													</logic:empty>
												</td>
											</tr>
											<logic:empty name="assuredPay">
												<tr>
													<td>
														<input type="hidden" name="assuredPay"></input>
													</td>
													<td>
														<img src="<%=path%>/images//tools_button02.gif"
															style="cursor:hand"
															onclick="document.forms[0].assuredPay.value='false';toMyspaceHasLogin()" />
													</td>
													<td>
														本网站不提供第三方支付担保。在您付款后，货款直接支付到卖家账户，更加快速便捷。
													</td>
												</tr>
												<tr>
													<td></td>
													<td>
														<img src="<%=path%>/images//tools_button01.gif"
															style="cursor:hand"
															onclick="document.forms[0].assuredPay.value='true';toMyspaceHasLogin()" />
													</td>
													<td>
														本网站为您提供第三方支付担保。在您付款后，货款先进入担保账户，您收到商品并对其满意后，才将货款支付给商家，更加安全。
													</td>
												</tr>
											</logic:empty>
											<logic:notEmpty name="assuredPay">
												<logic:equal name="assuredPay" value="false">
													<tr>
														<td></td>
														<td>
															<img src="<%=path%>/images//tools_button02.gif"
																style="cursor:hand" onclick="toMyspaceHasLogin()" />
														</td>
														<td>
															本网站不提供第三方支付担保。在您付款后，货款直接支付到卖家账户，更加快速便捷。
														</td>
													</tr>
												</logic:equal>
												<logic:equal name="assuredPay" value="true">
													<tr>
														<td></td>
														<td>
															<img src="<%=path%>/images//tools_button01.gif"
																style="cursor:hand" onclick="toMyspaceHasLogin()" />
														</td>
														<td>
															本网站为您提供第三方支付担保。在您付款后，货款先进入本网站担保账户，您收到商品并对其满意后，才将货款支付给商家，更加安全。
														</td>
													</tr>
												</logic:equal>
											</logic:notEmpty>
										</table>
									</td>
								</tr>
							</table>
						</logic:notEmpty>
					</div>
					<!-- 电话银行支付 -->
					<div class="box" id="cont_4" style="display:none;">
						<table width="100%" height="35" border="0" align="center"
							cellpadding="5" cellspacing="1"
							style="border-bottom:1px dashed #ccc;">
							<tr>
								<td width="100%" height="25" bgcolor="#FFFFFF"
									class="orangefont14b">
									您可以使用以下银行的电话银行支付：
								</td>
							</tr>
						</table>
						<table width="100%" border="0" align="center" cellpadding="5"
							cellspacing="1">
							<c:forEach var="bank" items="${telbanklist}" varStatus="status">
								<tr>
									<td width="23%" class="font_blue">
										<c:if test="${status.first}">请选择银行：</c:if>
									</td>
									<td width="77%" bgcolor="#FFFFFF">
										<input type="radio" style="border:0" name="telbank"
											value="<c:out value="${bank.bankCode}"/>"
											id="telcheck_<c:out value="${bank.bankCode}"/>" />
										<a
											href="javascript:selectTelBank('<c:out value="${bank.bankCode}"/>')"><img
												alt="<c:out value="${bank.bankName}"/>"
												src="<%=path%>/images/bank/logo/logo_<c:out value="${bank.bankCode}"/>.gif"
												height="40" align="absmiddle" border="0" /> </a>
									</td>
								</tr>
							</c:forEach>
							<tr>
								<td valign="top" class="font_blue">
									请输入预留电话：
								</td>
								<td bgcolor="#FFFFFF">
									<input type="text" class="inputStyle" name="orderTelephone"
										alt="预留电话" value="" maxlength="12" size="50">
									*
									<br />
									<br />
									1.固定电话或小灵通为区号加电话号码，如400 611 0909，不能带分机号。
									<br />
									2.手机号码11位，不带区号和0。
								</td>
							</tr>
							<tr>
								<td align="right" valign="top">
									&nbsp;
								</td>
								<td height="55" bgcolor="#FFFFFF">
									<input name="next" type="button" class="button_style"
										onclick="toBankTelPay(this);" value="下一步" />
								</td>
							</tr>
						</table>
					</div>
</html:form>
</div>
</div>
</div>
</div>
<script language="javascript">

function showTab(ID) 
{ 
    for(var i=1;i<=2;i++) 
    { 
		<logic:equal name="account" property="accountId" value="<%=Constant.TOPCARD_ACCOUNT_ID%>">
		// 卡调用接口时没有卡相关支付内容
		if(i == 3) {
			continue;
		}
		</logic:equal>
        if(ID==i) 
        { 
        	getObject('Tab_'+i).className='on'; 
        	getObject('cont_'+i).style.display=''; 
        } 
        else 
        { 
        	getObject('Tab_'+i).className='off'; 
        	getObject('cont_'+i).style.display='none'; 
        } 
    }
} 
function getObject(ID) 
{ 
    return document.getElementById(ID); 
}
</script>
<logic:notEmpty name="assuredPay">
	<logic:equal name="assuredPay" value="true">
		<script language="javascript">
    	showTab('2');
    </script>
	</logic:equal>
</logic:notEmpty>
